package com.thy.aop;


public enum LogTargetType {
    REGULAR_USER(1L, "普通用户"),
    ORDINARY_ADMINISTRATOR(2L, "普通管理员"),
    SUPER_ADMINISTRATOR(3L, "超级管理员"),
    SECTION(4L, "板块");

    //目标类型ID
    private final Long id;
    //目标类型描述
    private final String type;

    LogTargetType(Long id, String type) {
        this.id = id;
        this.type = type;
    }
    /**
     * 获取目标类型ID
     * @return 目标类型ID
     */
    public Long getId() {
        return id;
    }

    /**
     * 获取目标类型描述
     * @return 目标类型描述
     */
    public String getType() {
        return type;
    }

    /**
     * 根据ID获取对应的目标类型枚举
     * @param id 目标类型ID
     * @return 对应的枚举常量，若不存在则返回null
     */
    public static LogTargetType getById(Long id) {
        for (LogTargetType type : LogTargetType.values()) {
            if (type.getId().longValue() == id) {
                return type;
            }
        }
        return null;
    }
}
